package com.ruoyi.forum.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.forum.domain.vo.PostCollectUpvote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.forum.mapper.ForumPostUpvoteMapper;
import com.ruoyi.forum.domain.ForumPostUpvote;
import com.ruoyi.forum.service.IForumPostUpvoteService;

/**
 * 贴子-点赞Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-13
 */
@Service
public class ForumPostUpvoteServiceImpl implements IForumPostUpvoteService 
{
    @Autowired
    private ForumPostUpvoteMapper forumPostUpvoteMapper;

    /**
     * 查询贴子-点赞
     * 
     * @param id 贴子-点赞主键
     * @return 贴子-点赞
     */
    @Override
    public ForumPostUpvote selectForumPostUpvoteById(Long id)
    {
        return forumPostUpvoteMapper.selectForumPostUpvoteById(id);
    }

    /**
     * 查询贴子-点赞列表
     * 
     * @param forumPostUpvote 贴子-点赞
     * @return 贴子-点赞
     */
    @Override
    public List<ForumPostUpvote> selectForumPostUpvoteList(ForumPostUpvote forumPostUpvote)
    {
        return forumPostUpvoteMapper.selectForumPostUpvoteList(forumPostUpvote);
    }

    /**
     * 新增贴子-点赞
     * 
     * @param forumPostUpvote 贴子-点赞
     * @return 结果
     */
    @Override
    public int insertForumPostUpvote(ForumPostUpvote forumPostUpvote)
    {
        forumPostUpvote.setCreateTime(DateUtils.getNowDate());
        return forumPostUpvoteMapper.insertForumPostUpvote(forumPostUpvote);
    }

    /**
     * 修改贴子-点赞
     * 
     * @param forumPostUpvote 贴子-点赞
     * @return 结果
     */
    @Override
    public int updateForumPostUpvote(ForumPostUpvote forumPostUpvote)
    {
        return forumPostUpvoteMapper.updateForumPostUpvote(forumPostUpvote);
    }

    /**
     * 批量删除贴子-点赞
     * 
     * @param ids 需要删除的贴子-点赞主键
     * @return 结果
     */
    @Override
    public int deleteForumPostUpvoteByIds(Long[] ids)
    {
        return forumPostUpvoteMapper.deleteForumPostUpvoteByIds(ids);
    }

    @Override
    public int deleteForumPostUpvoteByUserPost(PostCollectUpvote postCollectUpvote) {
        return forumPostUpvoteMapper.deleteForumPostUpvoteByUserPost(postCollectUpvote);
    }

    /**
     * 删除贴子-点赞信息
     * 
     * @param id 贴子-点赞主键
     * @return 结果
     */
    @Override
    public int deleteForumPostUpvoteById(Long id)
    {
        return forumPostUpvoteMapper.deleteForumPostUpvoteById(id);
    }
}
